(function(global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('underscore'), require('mockjs'), require('./hauto')) :
    typeof define === 'function' && define.amd ? define(['underscore', 'mockjs', './hauto'], factory) :
    global.auto = factory(_, Mock, hauto);
}(this, function(_, Mock, hauto) {
  'use strict';

  function auto(vtemple, inum) {
    if (inum != null && _.isNumber(inum) && inum > 1) {
      var aset = [];
      for (var i = 0; i < inum; i++)
        aset.push(genData(vtemple));
      return aset;
    } else {
      return genData(vtemple);
    }
  }

  auto.Random = Mock.Random;

  auto.hauto = hauto;

  function genData(vtemple) {
    return Mock.mock(vtemple);
  }

  return auto;

}))
